#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    char buffer[100];
    FILE *file=fopen("bite","w+");

    if(file==NULL)
    {
        perror("Failed to open file");
        return EXIT_FAILURE;
    }
    //向文件中写入字符串
    fwrite("linux so easy!", sizeof(char), 15, file);

    //将文件指针重置到文件的开头
    fseek(file,0,SEEK_SET);
    //2.2从文件中读取内容
    fread(buffer,sizeof(char),15,file);
    buffer[15]='\0';

    printf("File content:%s\n",buffer);

    fclose(file);
    return 0;
}

